import {defineConfig} from 'vite';
import vue from '@vitejs/plugin-vue';
import VueSetupExtend from 'vite-plugin-vue-setup-extend';
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import {ElementPlusResolver} from 'unplugin-vue-components/resolvers';
import path from 'path'

export default defineConfig({
	base: './',
	plugins: [
		vue(),
		VueSetupExtend(),
		AutoImport({
			resolvers: [ElementPlusResolver()]
		}),
		Components({
			resolvers: [ElementPlusResolver()]
		})
	],
  // resolve: {
  //   alias: {
  //     '@': path.resolve(__dirname, './src'), // 路径别名
  //     '@img': path.resolve(__dirname, './src/assets/images'), // 路径别名
  //   },
	// },
	server: {
		host: '0.0.0.0',
		proxy: {
			'/ft': {
        // target: `http://10.2.16.158:8080`,
        target: `http://10.2.15.153:9007`,
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/ft/, '')
      },
      '/admin3': {
        // target: `http://10.2.16.158:8888/admin3`,
        target: `http://10.2.15.153:18081/admin3`,
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/admin3/, '')
      },
		},
	},
	optimizeDeps: {
		include: ['schart.js']
	}
});
